Support sys.config.src in common test #2571
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2096
Hello!
It's really nice to call
rebar3 shelland have.config.srcfiles automatically loaded, much like they are in Erlang releases. I was surprised to see thatrebar3 ctdoesn't do the same sort of substitution with environment variables. With these changes, it is now possible.A big portion of this PR is moving
consult_env_config/2fromrebar_priv_shell.erltorebar_file_utils.erl.I have some remaining questions/statements:
rebar_file_utils:consult_config/2read the extension of the file, and automatically callconsult_env_configif the extension is.src? The branching for.configand.config.srcis currently duplicated, but I'm not exactly sure if it's the right move to DRY in this case.consult_configto only prependRootDirif a config fileconsulted from a .config file is a relative path.erl -man configseems to recommend using absolute paths in sys.config files, so I wanted to be sure that we don't do any unfortunate path mangling when there an absolute path is found.env_fileoption ineunit_opts, add a .config.src file to test/rebar_eunit_SUITE_data/syscfg_app.zip, along with an appropriate env_file. I could probably submit that as another PR; just say the word :)rebar_prv_common_testcurrently callsrebar_prv_shell:maybe_set_env_vars, introducing a dependency edge between two provider modules that didn't exist before. I don't mind movingmaybe_set_env_varsto a module likerebar_file_utilsif you'd like to avoid coupling the rebar_prv_shell and rebar_prv_common_test.